package com.landinfo.domain;

import io.swagger.annotations.ApiModelProperty;
import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;
import java.util.Objects;

/**
 * A BookMark.
 */
@Entity
@Table(name = "book_mark")
// @Cache(usage = CacheConcurrencyStrategy.NONSTRICT_READ_WRITE)
public class BookMark implements Serializable {

  private static final long serialVersionUID = 1L;

  @Id
//  @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "sequenceGenerator")
//  @SequenceGenerator(name = "sequenceGenerator")
  @GeneratedValue(generator = "system-uuid")
  @GenericGenerator(name = "system-uuid", strategy = "uuid2")
  private String id;

  @NotNull
  @Size(max = 50)
  @Column(name = "bmname", length = 50, nullable = false)
  private String bmname;

  @NotNull
  @Column(name = "bmxmin", nullable = false)
  private Double bmxmin;

  @NotNull
  @Column(name = "bmxmax", nullable = false)
  private Double bmxmax;

  @NotNull
  @Column(name = "bmymin", nullable = false)
  private Double bmymin;

  @NotNull
  @Column(name = "bmymax", nullable = false)
  private Double bmymax;

  @NotNull
  @Column(name = "bmspatial_reference", nullable = false)
  private Integer bmspatialReference;

  @Column(name = "remark")
  private String remark;

  /**
   * 标注内容
   */
  @ApiModelProperty(value = "标注内容")
  @Type(type = "org.hibernate.type.TextType")
  @Column(name = "markContent")
  private String markContent;

  @ManyToOne
  private User user;

  public String getId() {
    return id;
  }

  public void setId(String id) {
    this.id = id;
  }

  public String getBmname() {
    return bmname;
  }

  public BookMark bmname(String bmname) {
    this.bmname = bmname;
    return this;
  }

  public void setBmname(String bmname) {
    this.bmname = bmname;
  }

  public Double getBmxmin() {
    return bmxmin;
  }

  public BookMark bmxmin(Double bmxmin) {
    this.bmxmin = bmxmin;
    return this;
  }

  public void setBmxmin(Double bmxmin) {
    this.bmxmin = bmxmin;
  }

  public Double getBmxmax() {
    return bmxmax;
  }

  public BookMark bmxmax(Double bmxmax) {
    this.bmxmax = bmxmax;
    return this;
  }

  public void setBmxmax(Double bmxmax) {
    this.bmxmax = bmxmax;
  }

  public Double getBmymin() {
    return bmymin;
  }

  public BookMark bmymin(Double bmymin) {
    this.bmymin = bmymin;
    return this;
  }

  public void setBmymin(Double bmymin) {
    this.bmymin = bmymin;
  }

  public Double getBmymax() {
    return bmymax;
  }

  public BookMark bmymax(Double bmymax) {
    this.bmymax = bmymax;
    return this;
  }

  public void setBmymax(Double bmymax) {
    this.bmymax = bmymax;
  }

  public Integer getBmspatialReference() {
    return bmspatialReference;
  }

  public BookMark bmspatialReference(Integer bmspatialReference) {
    this.bmspatialReference = bmspatialReference;
    return this;
  }

  public void setBmspatialReference(Integer bmspatialReference) {
    this.bmspatialReference = bmspatialReference;
  }

  public User getUser() {
    return user;
  }

  public BookMark user(User user) {
    this.user = user;
    return this;
  }

  public void setUser(User user) {
    this.user = user;
  }

  @Override
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    BookMark bookMark = (BookMark) o;
    if (bookMark.id == null || id == null) {
      return false;
    }
    return Objects.equals(id, bookMark.id);
  }

  @Override
  public int hashCode() {
    return Objects.hashCode(id);
  }

  @Override
  public String toString() {
    return "BookMark{" +
      "id=" + id +
      ", bmname='" + bmname + "'" +
      ", bmxmin='" + bmxmin + "'" +
      ", bmxmax='" + bmxmax + "'" +
      ", bmymin='" + bmymin + "'" +
      ", bmymax='" + bmymax + "'" +
      ", markContent='" + getMarkContent() + "'" +
      ", bmspatialReference='" + bmspatialReference + "'" +
      '}';
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark;
  }

    public String getMarkContent() {
        return markContent;
    }

    public void setMarkContent(String markContent) {
        this.markContent = markContent;
    }
}
